#include "../Item.h"
#include "../ItemList.h"
#include <assert.h>


void TestFood()
{
    ItemList<CFood> foods;
    foods.LoadItems("foods.dat", '#');
    assert(5 == foods.Count());
    foods.List();
    CFood &food = foods[3];
    food.ShowName();
    food.ShowDetail();
}

void TestEquipment()
{
    ItemList<CEquipment> equips;
    equips.LoadItems("equips.dat", '#');
    assert(2 == equips.Count());
    equips.List();
    CEquipment &equip = equips[1];
    equip.ShowDetail();
    assert(1 == equips.Index("草鞋"));
}


void TestBook()
{
    ItemList<CBook> books;
    books.LoadItems("books.dat", '#');
    assert(8 == books.Count());
    books.List();
    CBook &book = books[1];
    book.ShowDetail();
    assert(6 == books.Index("《太极剑谱》"));
}

int main()
{
    TestFood();
    TestEquipment();
    TestBook();
    return 0;
}
